function getItem(row) {
  return {
    "menuName": row.menuName,
    "menuType": 2,
    "parentId": row.parentId,
    "sort": 1,
    "path": row.path,
    "component": row.component,
    "frameFlag": false,
    "frameUrl": null,
    "cacheFlag": true,
    "visibleFlag": true,
    "disabledFlag": false,
    "permsType": 1,
    "webPerms": null,
    "apiPerms": null,
    "icon": "ApiOutlined",
    "contextMenuId": null,
    "menuId": row.menuId,
    "createTime": null,
    "createUserId": 2,
    "updateTime": null,
    "updateUserId": 1
  }
}

function getNode(row) {
  return {
    "menuName": row.menuName,
    "menuType": 1,
    "parentId": 0,
    "sort": 1,
    "path": null,
    "component": null,
    "frameFlag": false,
    "frameUrl": null,
    "cacheFlag": true,
    "visibleFlag": true,
    "disabledFlag": false,
    "permsType": 1,
    "webPerms": null,
    "apiPerms": null,
    "icon": "FileTextOutlined",
    "contextMenuId": null,
    "menuId": row.menuId,
    "createTime": null,
    "createUserId": 2,
    "updateTime": null,
    "updateUserId": null
  }
}

let list = [
  {
    menuName: "设备管理",
    menuId: 400,
    children: [
      // {
      //   menuName: "设备概览",
      //   path: "/device/index",
      //   component: "/device/home/index.vue",
      // },
      {
        menuName: "数据通道",
        path: "/device/box",
        component: "/device/box/index.vue",
      },
      {
        menuName: "设备信息",
        path: "/device/device",
        component: "/device/device/index.vue",
      },
      {
        menuName: "诊断服务",
        path: "/device/diagnosis",
        component: "/device/diagnosis/index.vue",
      },
    ],
  },
  {
    menuName: "数据处理",
    menuId: 200,
    children: [
      {
        menuName: "数据模型",
        path: "/rule/model",
        component: "/rule/model/index.vue",
      },
      {
        menuName: "融合规则",
        path: "/rule/fusion",
        component: "/rule/fusion/index.vue",
      },
      {
        menuName: "清洗规则",
        path: "/rule/clean",
        component: "/rule/clean/index.vue",
      },
      {
        menuName: "存储规则",
        path: "/rule/save",
        component: "/rule/save/index.vue",
      },
      {
        menuName: "开放规则",
        path: "/rule/output",
        component: "/rule/output/index.vue",
      },
      {
        menuName: "指标规则",
        path: "/rule/system",
        component: "/rule/system/index.vue",
      },
    ],
  },
  {
    menuName: "数据枢纽",
    menuId: 300,
    children: [
      {
        menuName: "接入数据",
        path: "/open/input",
        component: "/open/input/index.vue",
      },
      {
        menuName: "开放数据",
        path: "/open/output",
        component: "/open/output/index.vue",
      },
      {
        menuName: "存储数据",
        path: "/open/save",
        component: "/open/save/index.vue",
      },
    ],
  },
  {
    menuName: "视频流管理",
    menuId: 500,
    children: [
      {
        menuName: "视频流配置",
        path: "/cctv/config",
        component: "/cctv/config/index.vue",
      },
      {
        menuName: "视频直播",
        path: "/cctv/live",
        component: "/cctv/live/index.vue",
      },
    ],
  },
]
let menuList = []
for (let item of list) {
  menuList.push(getNode(item))
  for (let index in item.children) {
    const row = {
      parentId: item.menuId,
      menuId: item.menuId + parseInt(index) + 1,
      menuName: item.children[index].menuName,
      path: item.children[index].path,
      component: item.children[index].component,
    }
    menuList.push(getItem(row))
  }
}

export const loginMoack = {
  "code": 0,
  "level": null,
  "msg": "操作成功",
  "ok": true,
  "data": {
    "employeeId": 1,
    "userType": "ADMIN_EMPLOYEE",
    "loginName": "admin",
    "actualName": "管理员",
    "avatar": "public/common/1eea469452484ffea4a42570c4072466_20240702220447.jpg",
    "gender": 0,
    "phone": "13500000000",
    "departmentId": null,
    "departmentName": null,
    "disabledFlag": false,
    "administratorFlag": true,
    "remark": null,
    "ip": null,
    "userAgent": null,
    "token": "2095d7a054724727a5c44521ee1a10b5",
    "menuList": menuList,
    "lastLoginIp": "192.168.1.26",
    "lastLoginIpRegion": "0|0|0|内网IP|内网IP",
    "lastLoginUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
    "lastLoginTime": "2025-05-15 06:08:36",
    "userName": "管理员",
    "userId": 1
  },
  "dataType": 1
}

export const getUnreadCountMoack = { "code": 0, "level": null, "msg": "操作成功", "ok": true, "data": 3, "dataType": 1 }

export const getMetricsMoack = {
  "code": 0,
  "level": null,
  "msg": "操作成功",
  "ok": true,
  "data": {
    "systemCpuCount": 2,
    "systemCpuUsage": 0.002,
    "processCpuUsage": 0.0012,
    "processStartTime": 1746753884,
    "processUptime": 539370.558,
    "systemMemoryTotal": 481.07,
    "systemMemoryAvailable": 3.59,
    "jvmMemoryUsed": 93.86,
    "diskTotal": 3.5,
    "diskFree": 1.7
  },
  "dataType": 1
}

export const getSystemInfoMoack = {
  "code": 0,
  "level": null,
  "msg": "操作成功",
  "ok": true,
  "data": {
    "version": "1.0.0",
    "systemState": true,
    "pluginCount": 21,
    "deviceCount": 17,
    "appCount": 2,
    "ruleCount": 0,
    "funCount": 17
  },
  "dataType": 1
}

export const getLoginInfoMock = {
  "code": 0,
  "level": null,
  "msg": "操作成功",
  "ok": true,
  "data": {
    "employeeId": 1,
    "userType": "ADMIN_EMPLOYEE",
    "loginName": "admin",
    "actualName": "管理员",
    "avatar": "public/common/1eea469452484ffea4a42570c4072466_20240702220447.jpg",
    "gender": 0,
    "phone": "13500000000",
    "departmentId": null,
    "departmentName": null,
    "disabledFlag": false,
    "administratorFlag": true,
    "remark": null,
    "ip": "192.168.1.26",
    "userAgent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Mobile Safari/537.36",
    "token": "0d30578fec3545a5830e224f22147065",
    "menuList": menuList,
    "lastLoginIp": "192.168.1.26",
    "lastLoginIpRegion": "0|0|0|内网IP|内网IP",
    "lastLoginUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
    "lastLoginTime": "2025-05-15 08:05:26",
    "userName": "管理员",
    "userId": 1
  },
  "dataType": 1
}